require 'rubygems'
require 'datamapper'

# 何回呼び出しても大丈夫なのか？
# 普通 1 回だけだと思うけど．．．
DataMapper.setup(:default, "mysql://localhost/shard")


# メインテーブル
class Shard
  include DataMapper::Resource
  property :id, Serial
  property :board, Integer
  property :version, Integer
  property :svg, Text

  def self.last
    self.all(:order => [:id.desc]).first
  end
end

if __FILE__ == $0 then
  DataMapper.auto_migrate!
end

